home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Megahits 3
/
Megahits 3 (1994)(GTI - Rhein-Main-Soft)(DE)[!].iso
/
module
/
utilities
/
archives
/
k1ed_v5_31.lha
/
src
/
multied.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-10-29
|
26KB
|
1,154 lines
#include "inc.h"
#include "defs.h"
#include "req_manx_5.c"
#include "zz_pointer.h"
#include <exec/memory.h>
struct Image Image1 = {
0,67,
4,4,
0,
NULL,
0x0000,0x0000,
NULL
};
extern struct Gadget Gadget1;
extern struct PropInfo Gadget1SInfo;
extern int initmul[76];
extern struct GetStringStruct strstruct;
char *ToneName[12] =
{ "C ","C#","D ","D#","E ","F ","F#","G ","G#","A ","B ","H "
};
int soundnr[8];
int banknr[8];
int zonelow[8];
int zonehigh[8];
int poly[8];
int output[8];
int mode[8];
int rcvch[8];
int velo[8];
int transpose[8];
int tune[8];
int level[8];
int mastervolume;
long oldvol;
char name[11];
/* multied.c */
void DecodeMulti(const int nr);
void MultiEd(const int nr);
void DisplaySingleEdWindow(void);
void DisplayMultiEdWindow(void);
void EncodeMulti(int nr);
int MultiProp(int current, int max, int flag);
void DisplayLine(const int i);
void DisplayMultiValue(int flag,int val);
void TestMultiPatch(void);
unsigned char M[76];
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void DecodeMulti(const int nr)
{
int i;
mastervolume=m[nr][10];
for (i=0; i<=7; i++) /* Daten dekodieren */
{
int modelsb,modemsb;
soundnr[i] = (m[nr][11+i] & 7);
banknr[i] = (m[nr][11+i] & 56) >> 3;
zonelow[i] = m[nr][19+i];
zonehigh[i] = m[nr][27+i];
poly[i] = m[nr][35+i] & 15;
output[i] = (m[nr][35+i] & 48) >> 4;
modelsb = (m[nr][35+i] & 64) >> 6;
modemsb = (m[nr][43+i] & 64) >> 6;
rcvch[i] = m[nr][43+i] & 15;
velo[i] = (m[nr][43+i] & 48) >> 4;
transpose[i]= m[nr][51+i];
tune[i] = m[nr][59+i];
level[i] = m[nr][67+i];
mode[i] = 2*modemsb+modelsb;
}
}
void MultiEd(const int nr)
{
int i,j,refresh,startup=0;
int x,y,mx,my;
char string[255],title[255];
oldvol=Gadget1SInfo.VertPot;
for (i=0;i<=75;i++) M[i]=m[nr][i]; /* Daten sichern für Cancel */
DecodeMulti(nr);
refresh=0;
aufbau: ;
SetAPen(win->RPort,0);
SetBPen(win->RPort,0);
SetOPen(win->RPort,0);
RectFill(win->RPort,10,11,616,250);
Print(win,571,21," O K ");
MakeDBox(win,567,13,614,23);
Print(win,562,35,"Undo");
MakeDBox(win,548,27,606,37);
Print(win,557,50,"Print");
MakeDBox(win,548,42,606,52);
Print(win,553,65,"Rename");
MakeDBox(win,548,57,606,67);
Print(win,562,80,"Init");
MakeDBox(win,548,72,606,82);
Print(win,562,95,"Test");
MakeDBox(win,548,87,606,97);
Print(win,562,110,"Copy");
MakeDBox(win,548,102,606,112);
Print(win,562,125,"Swap");
MakeDBox(win,548,117,606,127);
for (j=0;j<=1;j++)
for(i=0;i<=4;i++)
MakeDBox(win,20+80*i,160+15*j,90+80*i,170+15*j);
Print(win,24+80*0,168,"ZL = C-2");
Print(win,24+80*1,168,"ZH = G 8");
Print(win,24+80*2,168,"Ch = 1-8");
Print(win,24+80*3,168,"Velo=All");
Print(win,24+80*4,168,"Out =L+R");
Print(win,24+80*0,183,"Poly= VR");
Print(win,24+80*1,183,"Mode=Mix");
Print(win,24+80*2,183,"Trans= 0");
Print(win,24+80*3,183,"Tune = 0");
Print(win,24+80*4,183,"Lev =100");
aufbau1: ;
for (i=0;i<=9;i++) name[i]=m[nr][i]; name[10]='\0';
strcpy(title,"KAWAI K1-II Librarian...Multipatch-Editor Selected: ");
strcat(title,name);
SetTitle(title);
Print(win,120,25,"ZoneL");
Print(win,170,25,"ZoneH");
Print(win,220,25,"Ch");
Print(win,254,25,"Velo");
Print(win,302,25,"Out");
Print(win,335,25,"Poly");
Print(win,374,25,"Mode");
Print(win,414,25,"Trans");
Print(win,458,25,"Tune");
Print(win,497,25,"Level");
Gadget1SInfo.VertPot=65535-mastervolume*656;
RefreshGadgets(&Gadget1,win,NULL);
start: ;
for (i=0;i<=7;i++) DisplayLine(i);
Line(win,15,30+15*i,540,30+15*i);
Line(win,15,30,15,150);
Line(win,115,30,115,150);
Line(win,165,30,165,150);
Line(win,215,30,215,150);
Line(win,245,30,245,150);
Line(win,295,30,295,150);
Line(win,335,30,335,150);
Line(win,365,30,365,150);
Line(win,415,30,415,150);
Line(win,455,30,455,150);
Line(win,495,30,495,150);
Line(win,540,30,540,150);
if (refresh != 0)
{
Forbid();
BeginRefresh(win);
RefreshWindowFrame(win);
EndRefresh(win,i);
Permit();
refresh=0;
}
if (startup==0)
{
ProgChange(64+nr);
startup=1;
}
else EncodeMulti(nr);
Loop: RefreshGadgets(&Gadget1,win,NULL);
MODWIN
WaitPort(win->UserPort);
while(mesg = (struct IntuiMessage *) GetMsg(win->UserPort))
{
class=mesg->Class;
code=mesg->Code;
x=mesg->MouseX;
y=mesg->MouseY;
ReplyMsg((struct Message *)mesg);
switch(class)
{
case ACTIVEWINDOW:
{
if (SCREEN==NULL) SetColours();
break;
}
case INACTIVEWINDOW:
{
if (SCREEN==NULL) SetOldColours();
break;
}
case NEWSIZE:
{
refresh=1;
goto aufbau;
break;
}
case CLOSEWINDOW:
{
Quit();
break;
}
case GADGETUP:
{
EncodeMulti(nr);
break;
}
case MOUSEBUTTONS:
{
if (code==MENUDOWN) /* OK */
{
/* EncodeMulti(nr);
SetAPen(win->RPort,0);
SetBPen(win->RPort,0);
SetOPen(win->RPort,0);
RectFill(win->RPort,10,11,616,250);
Gadget1SInfo.VertPot=oldvol;
RefreshGadgets(&Gadget1,win,NULL);
multi=1;
Display();
return(); */
}
if (code==SELECTDOWN)
{
if (Check(x,y,20,90,160,170)) /* ZoneLow */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
zonelow[i]=0;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,100,170,160,170)) /* ZoneHigh */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
zonehigh[i]=127;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,180,250,160,170)) /* Channel */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
rcvch[i]=i;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,260,330,160,170)) /* Velo */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
velo[i]=0;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,340,410,160,170)) /* Output */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
output[i]=1;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,20,90,175,185)) /* Poly */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
poly[i]=0;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,100,170,175,185)) /* Mode */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
mode[i]=2;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,180,250,175,185)) /* Trans */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
transpose[i]=24;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,260,330,175,185)) /* Tune */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
tune[i]=50;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,340,410,175,185)) /* Level */
{
if (MyReq("Please confirm choice !","Confirm","Cancel"))
{
for (i=0;i<=7;i++)
{
level[i]=100;
DisplayLine(i);
}
EncodeMulti(nr);
}
}
if (Check(x,y,567,614,13,23)) /* OK */
{
EncodeMulti(nr);
SetAPen(win->RPort,0);
SetBPen(win->RPort,0);
SetOPen(win->RPort,0);
RectFill(win->RPort,10,11,616,250);
Gadget1SInfo.VertPot=oldvol;
RefreshGadgets(&Gadget1,win,NULL);
multi=1;
Display();
return();
}
if (Check(x,y,548,606,27,37)) /* Undo */
{
int j;
if (MyReq("Are you shure ?"," Yes ","Oh no"))
{
for (j=0;j<=75;j++) m[nr][j]=M[j];
DecodeMulti(nr);
goto aufbau1;
}
}
if (Check(x,y,548,606,42,52)) /* Print */
{
PrintMulti(nr);
goto aufbau1;
}
if (Check(x,y,548,606,57,67)) /* Rename */
{
char st[20];
int i;
strstruct.titlebar =NULL;
strstruct.Window =win;
strstruct.visiblesize =10;
strstruct.versionnumber =REQVERSION;
strstruct.flags =NULL;
strstruct.rfu1 =NULL;
strstruct.rfu2 =NULL;
strstruct.rfu3 =NULL;
for (i=0;i<=9;i++) st[i]=m[nr][i];
for (i=9;i>=0;i--)
{
if (st[i] == 32) st[i]=0;
else break;
}
st[10]='\0';
strstruct.stringbuffer =&st[0];
strstruct.stringsize =11;
if (NewGetString(&strstruct))
{
int f;
for (f=0,i=0;i<=9;i++)
{
if (f == 0 && st[i] != 0) { m[nr][i]=st[i]; }
else {f=1; m[nr][i]=32; }
}
}
goto aufbau1;
}
if (Check(x,y,548,606,72,82)) /* Initialize */
{
int j;
if (MyReq("Are you shure ?"," Yes ","Oh no"))
{
for (j=0;j<=75;j++) m[nr][j]=initmul[j];
DecodeMulti(nr);
goto aufbau1;
}
}
if (Check(x,y,548,606,87,97)) /* Patch testen */
{
TestMultiPatch();
goto Loop;
}
if (Check(x,y,548,606,102,112)) /* Copy */
{
int mx,my;
Make_MultiWindow("Copy to...");
DisplayMultiEdWindow();
CopyLoop: WaitPort(win7->UserPort);
while (mesg=(struct IntuiMessage *) GetMsg(win7->UserPort))
{
ReplyMsg((struct Message *)mesg);
mx=mesg->MouseX;
my=mesg->MouseY;
if (mesg->Class == CLOSEWINDOW)
{
CloseWindow(win7);
goto start;
}
if (mesg->Class == MOUSEBUTTONS && mesg->Code == SELECTDOWN)
{
if (mx>15 && mx<215 && my>15 && my<175)
{
int num;
ZZ_POINTER(win);
if (mx>15 && mx<215) num=(my-15)/10*2+((mx<115)?0:1);
CloseWindow(win7);
EncodeMulti(nr);
for (i=0;i<=75;i++) m[num%32][i]=m[nr%32][i];
TransmitSingleMulti(num);
ProgChange(64+nr);
CLEAR_POINTER(win);
goto Loop;
}
else
{
goto CopyLoop;
}
}
}
goto CopyLoop;
}
if (Check(x,y,548,606,117,127)) /* Swap*/
{
int mx,my;
Make_MultiWindow("Swap with...");
DisplayMultiEdWindow();
SwapLoop: WaitPort(win7->UserPort);
while (mesg=(struct IntuiMessage *) GetMsg(win7->UserPort))
{
ReplyMsg((struct Message *)mesg);
mx=mesg->MouseX;
my=mesg->MouseY;
if (mesg->Class == CLOSEWINDOW)
{
CloseWindow(win7);
goto start;
}
if (mesg->Class == MOUSEBUTTONS && mesg->Code == SELECTDOWN)
{
if (mx>15 && mx<215 && my>15 && my<175)
{
int num;
if (mx>15 && mx<215) num=(my-15)/10*2+((mx<115)?0:1);
ZZ_POINTER(win);
CloseWindow(win7);
EncodeMulti(nr);
for (i=0;i<=75;i++)
{
int h;
h=m[num][i];
m[num][i]=m[nr][i];
m[nr][i]=h;
}
TransmitSingleMulti(nr);
TransmitSingleMulti(num);
ProgChange(nr);
DecodeMulti(nr);
for (i=0;i<=75;i++) M[i]=m[nr][i]; /* Daten sichern für Cancel */
CLEAR_POINTER(win);
goto aufbau1;
}
else
{
goto SwapLoop;
}
}
}
goto SwapLoop;
}
if (Check(x,y,15,115,30,150)) /* SinglePatchSelect */
{
y-=30;
Make_SingleWindow("Please select sound");
DisplaySingleEdWindow();
loop: WaitPort(win3->UserPort);
while(mesg=(struct IntuiMessage *) GetMsg(win3->UserPort))
{
mx=mesg->MouseX;
my=mesg->MouseY;
if (mesg->Class == CLOSEWINDOW)
{
ReplyMsg((struct Message *)mesg);
CloseWindow(win3);
goto start;
}
if (mesg->Class == MOUSEBUTTONS && mesg->Code == SELECTDOWN)
{
if (mx>15 && mx<415 && my>15 && my<175)
{
int num;
if (mx>15 && mx<215) num=(my-15)/10*2+((mx<115)?0:1);
if (mx>215 && mx<415) num=32+(my-15)/10*2+((mx<315)?0:1);
soundnr[y/15]=num%8;
banknr[y/15]=num/8;
ReplyMsg((struct Message *)mesg);
CloseWindow(win3);
DisplayLine(y/15);
EncodeMulti(nr);
goto Loop;
}
else
{
ReplyMsg((struct Message *)mesg);
goto loop;
}
}
ReplyMsg((struct Message *)mesg);
goto loop;
}
}
if (Check(x,y,115,165,30,150)) /* ZoneLow */
{
int num=(y-30)/15;
zonelow[num]=MultiProp(zonelow[num],127,0);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,165,215,30,150)) /* Zonehigh */
{
int num=(y-30)/15;
zonehigh[num]=MultiProp(zonehigh[num],127,1);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,215,245,30,150)) /* RcvCh */
{
int num=(y-30)/15;
rcvch[num]=MultiProp(rcvch[num],15,2);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,245,295,30,150)) /* Velo */
{
int num=(y-30)/15;
velo[num]++;
if (velo[num]>2) velo[num]=0;
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,295,335,30,150)) /* Output */
{
int num=(y-30)/15;
output[num]++;
if (output[num]>3) output[num]=0;
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,335,365,30,150)) /* Poly */
{
int sum;
int num=(y-30)/15;
poly[num]=MultiProp(poly[num],9,6);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,365,415,30,150)) /* Mode */
{
int num=(y-30)/15;
mode[num]++;
if (mode[num]>2) mode[num]=0;
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,415,455,30,150)) /* Transpose */
{
int num=(y-30)/15;
transpose[num]=MultiProp(transpose[num],48,3);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,455,495,30,150)) /* Tune */
{
int num=(y-30)/15;
tune[num]=MultiProp(tune[num],100,4);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
if (Check(x,y,495,540,30,150)) /* Level */
{
int num=(y-30)/15;
level[num]=MultiProp(level[num],100,5);
DisplayLine(num);
EncodeMulti(nr);
goto Loop;
}
} /* of SELECTDOWN */
break;
} /* of case MOUSEBUTTONS */
default: break;
}
}
goto Loop;
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void DisplaySingleEdWindow(void)
{
int i,n;
char name[11];
SetAPen(win3->RPort,2);
MakeBox(win3,15,13,415,93);
SetAPen(win3->RPort,1);
for (n=0;n<=31;n+=2)
{
Line(win3,15,13+n*5,415,13+n*5);
for (i=0;i<=9;i++) name[i]=s[0][n][i];
name[10]='\0';
Print(win3,20,21+n*5,name);
for (i=0;i<=9;i++) name[i]=s[0][n+1][i];
name[10]='\0';
Print(win3,120,21+n*5,name);
for (i=0;i<=9;i++) name[i]=s[1][n][i];
name[10]='\0';
Print(win3,220,21+n*5,name);
for (i=0;i<=9;i++) name[i]=s[1][n+1][i];
name[10]='\0';
Print(win3,320,21+n*5,name);
}
Line(win3,15,13+n*5,415,13+n*5);
Line(win3,15,13,15,13+n*5);
Line(win3,115,13,115,13+n*5);
Line(win3,215,13,215,13+n*5);
Line(win3,315,13,315,13+n*5);
Line(win3,415,13,415,13+n*5);
SetAPen(win3->RPort,2);
MakeBox(win3,15,13,415,53);
MakeBox(win3,15,53,415,93);
MakeBox(win3,15,93,415,133);
MakeBox(win3,15,133,415,173);
MakeBox(win3,15,13,115,173);
MakeBox(win3,215,13,315,173);
SetAPen(win3->RPort,1);
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void DisplayMultiEdWindow(void)
{
int i,n;
char name[11];
SetAPen(rp7,2);
MakeBox(win7,15,13,215,93);
SetAPen(rp7,1);
for (n=0;n<=31;n+=2)
{
Line(win7,15,13+n*5,215,13+n*5);
for (i=0;i<=9;i++) name[i]=m[n][i];
name[10]='\0';
Print(win7,20,21+n*5,name);
for (i=0;i<=9;i++) name[i]=m[n+1][i];
name[10]='\0';
Print(win7,120,21+n*5,name);
}
Line(win7,15,13+n*5,215,13+n*5);
Line(win7,15,13,15,13+n*5);
Line(win7,115,13,115,13+n*5);
Line(win7,215,13,215,13+n*5);
SetAPen(rp7,2);
MakeBox(win7,15,13,215,53);
MakeBox(win7,15,53,215,93);
MakeBox(win7,15,93,215,133);
MakeBox(win7,15,133,215,173);
MakeBox(win7,15,13,115,173);
MakeBox(win7,215,13,215,173);
SetAPen(rp7,1);
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void EncodeMulti(int nr)
{
int i,sum;
if (nr>64) /* user cancel */
{
for (i=0;i<=75;i++) m[nr-128][i]=M[i];
nr=nr-128;
goto Transmit;
}
mastervolume=99-Gadget1SInfo.VertPot/656;
mastervolume=mastervolume >99 ? 99 : mastervolume;
for (i=0;i<=9;i++) if(m[nr][i]==0) m[nr][i]=32;
for (i=0;i<=7;i++) /* kodiere */
{
m[nr][11+i]=(soundnr[i]+(banknr[i])*8) ;
m[nr][19+i]=zonelow[i] & 127;
m[nr][27+i]=zonehigh[i] & 127;
m[nr][35+i]=poly[i]+output[i]*16+(mode[i]%2)*64 ;
m[nr][43+i]=rcvch[i]+velo[i]*16+(mode[i]/2)*64 ;
m[nr][51+i]=transpose[i] & 127;
m[nr][58+i]=tune[i] & 127;
m[nr][67+i]=level[i] & 127;
}
sum=0;
for (i=0;i<=7;i++)
{
if (poly[i]>=2) sum=sum+poly[i]-1;
if (sum>8)
{
poly[i]=0;
DisplayLine(i);
MyReq("Warning: Can't send data because\nthere are more than 8 voices.\nPlease set number of voices to\n0 or VR",NULL," Ok ");
return();
}
}
m[nr][10]=mastervolume;
sum=0xa5; /* Prüfsumme berechnen */
for (i=0;i<=74;i++) sum=(sum+m[nr][i]) & 127;
m[nr][75]=sum;
Transmit: ;
TransmitSingleMulti(nr);
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
int MultiProp(int current,int max,int flag)
{
struct Gadget gad;
struct PropInfo prop;
char str[20];
long val;
char *flagstring[8]={"ZoneLow","ZoneHigh","RcvCh","Transpose","Tune","Level","Poly","Masterchn"};
str[0]=0;
Make_PropWindow(current != 0 ? 120*current/max+6 : 12);
prop.Flags=AUTOKNOB+FREEHORIZ;
prop.HorizPot=0;
prop.VertPot=-1;
prop.HorizBody=65535/max;
prop.VertBody=-1;
gad.NextGadget=NULL;
gad.LeftEdge=8;
gad.TopEdge=12;
gad.Width=125;
gad.Height=10;
gad.Flags=GADGHBOX;
gad.Activation=RELVERIFY+GADGIMMEDIATE;
gad.GadgetType=PROPGADGET;
gad.GadgetRender=(APTR)&Image1;
gad.SelectRender=NULL;
gad.GadgetText=NULL;
gad.MutualExclude=NULL;
gad.SpecialInfo=(APTR)∝
gad.GadgetID=0;
gad.UserData=0;
prop.HorizPot=prop.HorizBody*current;
AddGadget(win4,&gad,-1);
RefreshGadgets(&gad,win4,NULL);
strcat(str,flagstring[flag]);
Print(win4,10,9,&str[0]);
val=prop.HorizPot/prop.HorizBody;
DisplayMultiValue(flag,val);
loop: WaitPort(win4->UserPort);
mesg=(struct IntuiMessage *) GetMsg(win4->UserPort);
if (mesg->Class == GADGETDOWN)
{
ReplyMsg((struct Message *)mesg);
while(gad.Flags & SELECTED)
{
val=prop.HorizPot/prop.HorizBody;
DisplayMultiValue(flag,val);
}
goto loop;
}
if (mesg->Class == GADGETUP)
{
ReplyMsg((struct Message *)mesg);
val=prop.HorizPot/prop.HorizBody;
DisplayMultiValue(flag,val);
goto loop;
}
if (mesg->Class == MOUSEBUTTONS && mesg->Code==MENUDOWN)
{
ReplyMsg((struct Message *)mesg);
CloseWindow(win4);
return(prop.HorizPot/prop.HorizBody);
}
ReplyMsg((struct Message *)mesg);
goto loop;
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void DisplayMultiValue(int flag,int val)
{
char str[255];
if (flag==0) sprintf(str,"%2s%2ld",ToneName[val%12],(val/12)-2);
if (flag==1) sprintf(str,"%2s%2ld",ToneName[val%12],(val/12)-2);
if (flag==2) sprintf(str,"%3ld ",val+1);
if (flag==3) sprintf(str,"%3ld ",val-24);
if (flag==4) sprintf(str,"%3ld ",val-50);
if (flag==5) sprintf(str,"%3ld ",val);
if (flag==6)
{
if (val==0) sprintf(str," VR");
else sprintf(str,"%3ld ",val-1);
}
if (flag==7) sprintf(str,"%3ld ",val+1);
Print(win4,95,9,&str[0]);
}
/**********************************************************************************/
/*** Multiparameter darstellen ***/
/**********************************************************************************/
void DisplayLine(const int i)
{
int j,nr,sn,bn,yp;
char string[80],name[20];
yp=40;
sn=soundnr[i];
bn=banknr[i];
Line(win,15,30+15*i,540,30+15*i);
nr=sn+8*(bn>3 ? bn-4 : bn);
for (j=0;j<=9;j++) name[j]=s[bn>3 ? 1 : 0][nr][j];
name[10]='\0';
SetAPen(win->RPort,0);
SetBPen(win->RPort,0);
SetOPen(win->RPort,0);
RectFill(win->RPort,16,31+15*i,114,44+15*i);
Print(win,23,15*i+yp,name); /* Soundname */
if (poly[i]==1)
{
Line(win,16,31+15*i,114,44+15*i);
Line(win,16,44+15*i,114,31+15*i);
}
sprintf(string,"%2s%2ld ",ToneName[zonelow[i]%12],(int)(zonelow[i]/12)-2);
Print(win,122,15*i+yp,string);
sprintf(string,"%2s%2d ",ToneName[zonehigh[i]%12],(int)(zonehigh[i]/12)-2);
Print(win,172,15*i+yp,string);
sprintf(string,"%2ld ",rcvch[i]+1);
Print(win,220,15*i+yp,string);
if(velo[i]==0) strcpy(string,"All ");
if(velo[i]==1) strcpy(string,"Soft");
if(velo[i]==2) strcpy(string,"Loud");
Print(win,254,15*i+yp,string);
if(output[i]==0) strcpy(string," R ");
if(output[i]==1) strcpy(string,"R+L");
if(output[i]==2) strcpy(string," L ");
if(output[i]==3) strcpy(string,"Byp");
Print(win,302,15*i+yp,string);
if(poly[i]==0) strcpy(string,"VR");
else sprintf(string,"%ld ",poly[i]-1);
Print(win,342,15*i+yp,string);
if(mode[i]==0) strcpy(string,"Keyb");
if(mode[i]==1) strcpy(string,"Midi");
if(mode[i]==2) strcpy(string,"Mix ");
Print(win,374,15*i+yp,string);
sprintf(string,"%3ld ",transpose[i]-24);
Print(win,423,15*i+yp,string);
sprintf(string,"%3ld ",tune[i]-50);
Print(win,463,15*i+yp,string);
sprintf(string,"%3ld ",level[i]);
Print(win,503,15*i+yp,string);
}
/**********************************************************************************/
/*** ***/
/**********************************************************************************/
void TestMultiPatch(void)
{
FILE *fp,*fopen();
char com[2];
int ie,err;
static struct NewWindow nw;
static struct Window *WIN;
static struct RastPort *RP;
int i,id;
static char str[20];
static char string[20][20];
static struct GadgetBlock buf[17];
int channel;
nw.LeftEdge = 20;
nw.TopEdge = 20;
nw.Width = 145;
nw.Height = 75;
nw.DetailPen = 0;
nw.BlockPen = 1;
nw.Title =" Select channel dm";
nw.Flags = RMBTRAP|ACTIVATE|REPORTMOUSE|SMART_REFRESH|WINDOWDRAG;
nw.IDCMPFlags = MOUSEBUTTONS|GADGETUP|GADGETDOWN;
nw.Type = (SCREEN != 0 ? CUSTOMSCREEN : WBENCHSCREEN);
nw.CheckMark = NULL;
nw.NextGadget=NULL;
nw.Screen = (SCREEN != 0 ? scr : NULL);
nw.BitMap = NULL;
nw.MinWidth = 0;
nw.MinHeight = 0;
nw.MaxWidth = 0;
nw.MaxHeight = 0;
nw.FirstGadget=NULL;
for (i=0;i<=15;i++)
{
sprintf(string[i],"%2d",i+1);
MakeGadget(&buf[i],&string[i][0],30*(i%4)+20,15*(i/4)+15);
buf[i].Gadget.GadgetID=i+1;
buf[i].Gadget.NextGadget=nw.FirstGadget;
nw.FirstGadget=&buf[i].Gadget;
}
Center(&nw,-60,0);
WIN=(struct Window *) OpenWindow(&nw);
if (WIN==NULL) Error("Can't open channel-window");
RP=WIN->RPort;
SetFont(RP,textfont);
Loop: ;
WaitPort(WIN->UserPort);
mesg=(struct IntuiMessage *) GetMsg(WIN->UserPort);
class=mesg->Class;
code=mesg->Code;
id=mesg->IAddress->GadgetID;
ReplyMsg((struct Message *)mesg);
switch(class)
{
case MOUSEBUTTONS:
{
if (code==MENUDOWN)
{
CloseWindow(WIN);
return();
}
break;
}
case GADGETUP:
{
channel=id-1;
goto Loop1;
break;
}
default: goto Loop;
}
goto Loop;
Loop1: CloseWindow(WIN);
TestSound(channel);
}